home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 6
/
FM Towns Free Software Collection 6.iso
/
ms_dos
/
txf
/
src
/
txfrmz.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-07-08
|
1KB
|
50 lines
/***************
*
* g:\exe\txf\src\txfrmz.c
*/
#include "txf.h"
void removeeof()
{
int chr = NUL;
char *tmpinname, *tmpoutname;
FILE *tmpin, *tmpout;
if (viewmode > 0) {
fprintf(stderr, "TXF Remove ctrl-Z module. Ver1.20\n");
}
tmpinname = ((tmpinfile == -1) ? inputfile : tfile[tmpinfile]);
tmpoutname = tfile[((tmpinfile > 0) ? 0 : 1)];
if (*tmpinname != NUL) {
tmpin = fopen(tmpinname, "rb");
}
else {
tmpin = stdin;
}
tmpout = fopen(tmpoutname, "wb");
if (viewmode > 2) {
fprintf(stderr, "Info:readfile=%s,(%d)/writefile=%s,(%d)\n",
tmpinname, tmpin, tmpoutname, tmpout);
}
if ((tmpin == NULL) || (tmpout == NULL)) {
errexit("cannot open TMP/input file(remove ctrl-Z)\n");
}
while (chr != EOF) {
chr = getc(tmpin);
if ((chr != 0x1a) && (chr != EOF)) {
putc((char)chr, tmpout);
}
}
tmpinfile = ((tmpinfile > 0) ? 0 : 1);
tmpinname = tfile[tmpinfile];
tmpoutname = tfile[1 - tmpinfile];
fclose(tmpin);
fclose(tmpout);
}